using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Calendar_List - 日程安排 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class ICalendarList<T> :ModelBase<CalendarList> where T : CalendarList, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.DayId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return DayId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.DayId=dy.DayId;
           this.UserId=dy.UserId;
           this.Title=dy.Title;
           this.Detailed=dy.Detailed;
           this.TipsColor=dy.TipsColor;
           this.SubmitTime=dy.SubmitTime;
           this.OpenTime=dy.OpenTime;
           this.OverTime=dy.OverTime;
           this.NextTime=dy.NextTime;
           this.IsClose=dy.IsClose;
           this.IsAllDay=dy.IsAllDay;
           this.RepeatType=dy.RepeatType;
           this.RepeatInterval=dy.RepeatInterval;
           this.RepeatTime=dy.RepeatTime;
           this.Version=dy.Version;
        } 

        #region 定义属性

     
         /// <summary>
        /// 日程ID
        /// </summary>
        private String _DayId = "";
      
        /// <summary>
        /// 日程ID
        /// </summary>
        public String DayId
        {
            get 
            {
              return   (this._DayId); 
            }

            set 
            {
                    _DayId= value;  
            }
        }
       
     
         /// <summary>
        /// 用户ID
        /// </summary>
        private String _UserId = "";
      
        /// <summary>
        /// 用户ID
        /// </summary>
        public String UserId
        {
            get 
            {
              return   (this._UserId); 
            }

            set 
            {
                    _UserId= value;  
            }
        }
       
     
         /// <summary>
        /// 标题
        /// </summary>
        private String _Title = "";
      
        /// <summary>
        /// 标题
        /// </summary>
        public String Title
        {
            get 
            {
              return   (this._Title); 
            }

            set 
            {
                    _Title= value;  
            }
        }
       
     
         /// <summary>
        /// 说明
        /// </summary>
        private String _Detailed = "";
      
        /// <summary>
        /// 说明
        /// </summary>
        public String Detailed
        {
            get 
            {
              return   (this._Detailed); 
            }

            set 
            {
                    _Detailed= value;  
            }
        }
       
     
         /// <summary>
        /// 提示颜色
        /// </summary>
        private String _TipsColor = "";
      
        /// <summary>
        /// 提示颜色
        /// </summary>
        public String TipsColor
        {
            get 
            {
              return   (this._TipsColor); 
            }

            set 
            {
                    _TipsColor= value;  
            }
        }
       
     
         /// <summary>
        /// 创建时间
        /// </summary>
        private DateTime _SubmitTime =DateTime.MinValue;
      
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime SubmitTime
        {
            get 
            {
              return   (this._SubmitTime); 
            }

            set 
            {
                    _SubmitTime= value;  
            }
        }
       
     
         /// <summary>
        /// 日程时间开始
        /// </summary>
        private DateTime _OpenTime =DateTime.MinValue;
      
        /// <summary>
        /// 日程时间开始
        /// </summary>
        public DateTime OpenTime
        {
            get 
            {
              return   (this._OpenTime); 
            }

            set 
            {
                    _OpenTime= value;  
            }
        }
       
     
         /// <summary>
        /// 日程结束时间
        /// </summary>
        private DateTime _OverTime =DateTime.MinValue;
      
        /// <summary>
        /// 日程结束时间
        /// </summary>
        public DateTime OverTime
        {
            get 
            {
              return   (this._OverTime); 
            }

            set 
            {
                    _OverTime= value;  
            }
        }
       
     
         /// <summary>
        /// 下一次通知时间
        /// </summary>
        private DateTime _NextTime =DateTime.MinValue;
      
        /// <summary>
        /// 下一次通知时间
        /// </summary>
        public DateTime NextTime
        {
            get 
            {
              return   (this._NextTime); 
            }

            set 
            {
                    _NextTime= value;  
            }
        }
       
     
         /// <summary>
        /// 是否不公开
        /// </summary>
        private int _IsClose =-1;
      
        /// <summary>
        /// 是否不公开
        /// </summary>
        public yq.Enums.BooleanType IsClose
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsClose; 
            }

            set 
            {
                    _IsClose= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 是否全天
        /// </summary>
        private int _IsAllDay =-1;
      
        /// <summary>
        /// 是否全天
        /// </summary>
        public yq.Enums.BooleanType IsAllDay
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsAllDay; 
            }

            set 
            {
                    _IsAllDay= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 重复类型
        /// </summary>
        private int _RepeatType =-1;
      
        /// <summary>
        /// 重复类型
        /// </summary>
        public yq.Enums.CalendarList.RepeatType RepeatType
        {
            get 
            {
              return   (yq.Enums.CalendarList.RepeatType)this._RepeatType;  
            }

            set 
            {
                    _RepeatType= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 重复间隔
        /// </summary>
        private String _RepeatInterval = "";
      
        /// <summary>
        /// 重复间隔
        /// </summary>
        public String RepeatInterval
        {
            get 
            {
              return   (this._RepeatInterval); 
            }

            set 
            {
                    _RepeatInterval= value;  
            }
        }
       
     
         /// <summary>
        /// 重复结束日期
        /// </summary>
        private DateTime _RepeatTime =DateTime.MinValue;
      
        /// <summary>
        /// 重复结束日期
        /// </summary>
        public DateTime RepeatTime
        {
            get 
            {
              return   (this._RepeatTime); 
            }

            set 
            {
                    _RepeatTime= value;  
            }
        }
       
     
       

      #endregion 定义属性 

          protected internal override void SetValue(CalendarList info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["DayId"]!= DBNull.Value)
                  {
                  info.DayId=row["DayId"].ToString();
                 }
                 
                  
                  if(row["UserId"]!= DBNull.Value)
                  {
                  info.UserId=row["UserId"].ToString();
                 }
                 
                  
                  if(row["Title"]!= DBNull.Value)
                  {
                  info.Title=row["Title"].ToString();
                 }
                 
                  
                  if(row["Detailed"]!= DBNull.Value)
                  {
                  info.Detailed=row["Detailed"].ToString();
                 }
                 
                  
                  if(row["TipsColor"]!= DBNull.Value)
                  {
                  info.TipsColor=row["TipsColor"].ToString();
                 }
                 
                  
                  if(row["SubmitTime"]!= DBNull.Value)
                  {
                  info.SubmitTime=Convert.ToDateTime(row["SubmitTime"]);
                 }
                 
                  
                  if(row["OpenTime"]!= DBNull.Value)
                  {
                  info.OpenTime=Convert.ToDateTime(row["OpenTime"]);
                 }
                 
                  
                  if(row["OverTime"]!= DBNull.Value)
                  {
                  info.OverTime=Convert.ToDateTime(row["OverTime"]);
                 }
                 
                  
                  if(row["NextTime"]!= DBNull.Value)
                  {
                  info.NextTime=Convert.ToDateTime(row["NextTime"]);
                 }
                 
                  
                  if(row["IsClose"]!= DBNull.Value)
                  {
                  info.IsClose= (yq.Enums.BooleanType)(row["IsClose"]) ;
                 }
                 
                  
                  if(row["IsAllDay"]!= DBNull.Value)
                  {
                  info.IsAllDay= (yq.Enums.BooleanType)(row["IsAllDay"]) ;
                 }
                 
                  
                  if(row["RepeatType"]!= DBNull.Value)
                  {
                  info.RepeatType=  (yq.Enums.CalendarList.RepeatType)(row["RepeatType"]) ;
                 }
                 
                  
                  if(row["RepeatInterval"]!= DBNull.Value)
                  {
                  info.RepeatInterval=row["RepeatInterval"].ToString();
                 }
                 
                  
                  if(row["RepeatTime"]!= DBNull.Value)
                  {
                  info.RepeatTime=Convert.ToDateTime(row["RepeatTime"]);
                 }
                 
                  
                  if(row["Version"]!= DBNull.Value)
                  {
                  info.Version=row["Version"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, CalendarList info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@DayId", DbType.String,ParameterTool.GetObj( info._DayId )); 
            
             
                cn.AddInParameter(comm, "@UserId", DbType.String,ParameterTool.GetObj( info._UserId )); 
            
             
                cn.AddInParameter(comm, "@Title", DbType.String,ParameterTool.GetObj( info._Title )); 
            
             
                cn.AddInParameter(comm, "@Detailed", DbType.String,ParameterTool.GetObj( info._Detailed )); 
            
             
                cn.AddInParameter(comm, "@TipsColor", DbType.String,ParameterTool.GetObj( info._TipsColor )); 
            
             
                cn.AddInParameter(comm, "@SubmitTime", DbType.DateTime,ParameterTool.GetObj( info._SubmitTime )); 
            
             
                cn.AddInParameter(comm, "@OpenTime", DbType.DateTime,ParameterTool.GetObj( info._OpenTime )); 
            
             
                cn.AddInParameter(comm, "@OverTime", DbType.DateTime,ParameterTool.GetObj( info._OverTime )); 
            
             
                cn.AddInParameter(comm, "@NextTime", DbType.DateTime,ParameterTool.GetObj( info._NextTime )); 
            
             
                cn.AddInParameter(comm, "@IsClose", DbType.Int32,ParameterTool.GetObj( info._IsClose )); 
            
             
                cn.AddInParameter(comm, "@IsAllDay", DbType.Int32,ParameterTool.GetObj( info._IsAllDay )); 
            
             
                cn.AddInParameter(comm, "@RepeatType", DbType.Int32,ParameterTool.GetObj( info._RepeatType )); 
            
             
                cn.AddInParameter(comm, "@RepeatInterval", DbType.String,ParameterTool.GetObj( info._RepeatInterval )); 
            
             
                cn.AddInParameter(comm, "@RepeatTime", DbType.DateTime,ParameterTool.GetObj( info._RepeatTime )); 
            
                
                cn.AddInParameter(comm,"@Version", DbType.String, Guid.NewGuid().ToString());
              

                cn.AddInParameter(comm,"@_versionOdl", DbType.String, info._Version); 
                 
        } 

    } 
} 